var Zan = require('../../../dist/index');

Page(Object.assign({}, Zan.Switch, {
	data: {
		active: {
			checked: true,
			loading: false
		},
		lease: {
			checked: true,
			loading: false
		},
		jurisdiction: {
			checked: true,
			loading: false
		},
	},

	handleZanSwitchChange(e) {
		var componentId = e.componentId;
		var checked = e.checked;

		// 异步开关
		this.setData({
			[`${componentId}.loading`]: true
		});
		setTimeout(() => {
			this.setData({
				[`${componentId}.loading`]: false,
				[`${componentId}.checked`]: checked
			});
		}, 500);
	}
}));